/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package inputsms.utilities;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;

/**
 *
 * @author aisyah
 */
public class Property {

    private static Logger logger = Logger.getLogger(Property.class);
    private final static Properties prop = new Properties();
    private static Properties propOption = new Properties();

    static {
        try {
            FileInputStream in = new FileInputStream("config/conf.properties");
            prop.load(in);
            in.close();
        } catch (FileNotFoundException ex) {
            logger.error("file conf.properties not found");
//            Logger.getLogger(Property.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            logger.error("file conf.properties not found");
//            Logger.getLogger(Property.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static String getProperty(String keys) {
        String value = prop.getProperty(keys);
        return value;
    }

    public static String getPropOption(String operator, String keys) {
        try {
            FileInputStream in = new FileInputStream("config/operator/" + operator + ".properties");
            propOption.load(in);
        } catch (IOException e) {
            logger.error("file "+operator+".prperties not found");
//            Logger.getLogger(Property.class.getName()).log(Level.SEVERE, "file " + operator + ".properties not found", e);
        }
        String value = propOption.getProperty(keys);
        return value;
    }
}
